import request from "@/utils/request"
import { type AdminResult, type Update_Admin, type Updata_pass } from "@/types/Admin"

enum API {
    Admin = "/admin/users",
    Admin_renewal = "/admin/users/renewal",
    USRINFO_URL = "/user/info"
}
type admin_login = {
    username: string,
    password: string
}

export const admin_login = (data: admin_login) => request<AdminResult>({
    method: "POST",
    url: API.Admin,
    data
})
export const admin_updata = (data: Update_Admin) => request({
    method: "put",
    url: API.Admin,
    data
})
export const admin_updata_avatar = (urls: string) => request({
    method: "put",
    url: API.Admin,
    data: {
        avatar: urls
    }
})
export const admin_updata_password = (data: Updata_pass) => request({
    method: "put",
    url: API.Admin_renewal,
    data
})